﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;

namespace WebApplication
{
    public partial class SanPhams : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack){
                PopulateControls();
            }
        }

        private void PopulateControls()
        {
            string IdSanPham = Request.QueryString["IDSP"];
            Entities.SanPham data = SanPhamBLL.TimDon(IdSanPham);
            if (data != null)
            {
                lblTenSanPham.Text = data.TenSP;
                lblGia.Text = String.Format("{0: 0,0 VND}", data.Gia);
                HinhAnhSP.ImageUrl = LinkBLL.ToHinhAnhSanPham(data.HinhAnh);
                lnkThemVaoGioHang.NavigateUrl = LinkBLL.ToGioHang(IdSanPham);
                lblMoTa.Text = data.MoTa;
            }
        }
    }
}